const LOGIN_COOKIE_NAME = 'sessionId'
const TOKEN = 'token'
const USER = 'sessionId'

export function isAuthenticated () {
    return sessionStorage.getItem(TOKEN)
}
export function logout () {
    sessionStorage.removeItem(TOKEN);
}

export function authenticateSuccess (v) {
    sessionStorage.setItem(TOKEN, v);
}

export function getUser () {
    return JSON.parse(localStorage.getItem('user'))
}

export const setlocalStorage = (key,value) =>{
    localStorage.setItem(key,value)
}
export const dellocalStorage =(key) =>{
    localStorage.removeItem(key);
}
export const getlocalStorage = (key, type) =>{
    let info =  localStorage.getItem(key) || ''
    if(type==='object'){
        info = info ?  JSON.parse(info) : {}
    }
    return info
}
